package com.itheima.mymap;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

public class HashMapTestStudent {
    public static void main(String[] args) {
        HashMap<Student,String> map = new HashMap<>();
        Student s1 = new Student ("张三",23);
        Student s2 = new Student ("张三",23);
        map.put(s1,"南京");
        map.put(s2,"南京");
        System.out.println(map);

        Set<Map.Entry<Student, String>> entries = map.entrySet();
        for (Map.Entry<Student, String> entry : entries) {
            Student key = entry.getKey();
            String value = entry.getValue();
            System.out.println(key.getName()+"  "+value);
        }
    }
}
